#include <stdio.h>

int my_max(int a, int b)
{
	if (a > b)
			return a;
	else
			return b;
}

int my_min(int a, int b)
{
	if (a < b)
			return a;
}

void main()
{

}


#if 0

两个函数的唯一区别就是条件转移指令:第一个函数使用的是JGE(Jump if Greater or Equal)，第二个函数使用的是JLE(Jump if Less or Equal)

#endif

#if 0
/*
 * intel
 */
0000000000001129 <my_max>:
    1129:	f3 0f 1e fa          	endbr64 
    112d:	55                   	push   %rbp
    112e:	48 89 e5             	mov    %rsp,%rbp
    1131:	89 7d fc             	mov    %edi,-0x4(%rbp)
    1134:	89 75 f8             	mov    %esi,-0x8(%rbp)
    1137:	8b 45 fc             	mov    -0x4(%rbp),%eax
    113a:	3b 45 f8             	cmp    -0x8(%rbp),%eax
    113d:	7e 05                	jle    1144 <my_max+0x1b>
    113f:	8b 45 fc             	mov    -0x4(%rbp),%eax
    1142:	eb 03                	jmp    1147 <my_max+0x1e>
    1144:	8b 45 f8             	mov    -0x8(%rbp),%eax
    1147:	5d                   	pop    %rbp
    1148:	c3                   	retq   

0000000000001149 <my_min>:
    1149:	f3 0f 1e fa          	endbr64 
    114d:	55                   	push   %rbp
    114e:	48 89 e5             	mov    %rsp,%rbp
    1151:	89 7d fc             	mov    %edi,-0x4(%rbp)
    1154:	89 75 f8             	mov    %esi,-0x8(%rbp)
    1157:	8b 45 fc             	mov    -0x4(%rbp),%eax
    115a:	3b 45 f8             	cmp    -0x8(%rbp),%eax
    115d:	7d 05                	jge    1164 <my_min+0x1b>
    115f:	8b 45 fc             	mov    -0x4(%rbp),%eax
    1162:	eb 00                	jmp    1164 <my_min+0x1b>
    1164:	5d                   	pop    %rbp
    1165:	c3                   	retq   

0000000000001166 <main>:
    1166:	f3 0f 1e fa          	endbr64 
    116a:	55                   	push   %rbp
    116b:	48 89 e5             	mov    %rsp,%rbp
    116e:	90                   	nop
    116f:	5d                   	pop    %rbp
    1170:	c3                   	retq   
    1171:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
    1178:	00 00 00 
    117b:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)

/*
 * arm
 */
000000000040051c <my_max>:
  40051c:	d10043ff 	sub	sp, sp, #0x10
  400520:	b9000fe0 	str	w0, [sp, #12]
  400524:	b9000be1 	str	w1, [sp, #8]
  400528:	b9400fe1 	ldr	w1, [sp, #12]
  40052c:	b9400be0 	ldr	w0, [sp, #8]
  400530:	6b00003f 	cmp	w1, w0
  400534:	5400006d 	b.le	400540 <my_max+0x24>
  400538:	b9400fe0 	ldr	w0, [sp, #12]
  40053c:	14000002 	b	400544 <my_max+0x28>
  400540:	b9400be0 	ldr	w0, [sp, #8]
  400544:	910043ff 	add	sp, sp, #0x10
  400548:	d65f03c0 	ret

000000000040054c <my_min>:
  40054c:	d10043ff 	sub	sp, sp, #0x10
  400550:	b9000fe0 	str	w0, [sp, #12]
  400554:	b9000be1 	str	w1, [sp, #8]
  400558:	b9400fe1 	ldr	w1, [sp, #12]
  40055c:	b9400be0 	ldr	w0, [sp, #8]
  400560:	6b00003f 	cmp	w1, w0
  400564:	5400006a 	b.ge	400570 <my_min+0x24>  // b.tcont
  400568:	b9400fe0 	ldr	w0, [sp, #12]
  40056c:	14000001 	b	400570 <my_min+0x24>
  400570:	910043ff 	add	sp, sp, #0x10
  400574:	d65f03c0 	ret

0000000000400578 <main>:
  400578:	d503201f 	nop
  40057c:	d65f03c0 	ret


#endif

